home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 49
/
Aminet 49 (2002)(GTI - Schatztruhe)[!][Jun 2002].iso
/
Aminet
/
util
/
misc
/
LC2.lha
/
src
/
LC2s.BAS
< prev
Wrap
BASIC Source File
|
2001-07-30
|
38KB
|
884 lines
REM LOTTO CHECK version 2.0 Copy-right 1997 Lorence Lombardo.
REM lory@subdimension.com
REM This program is Free software; you can redistribute it and/or modify
REM it under the terms of the GNU General Public License as published by
REM the Free Software Foundation; either version 2 of the License, or
REM (at your option) any later version.
REM This program is distributed in the hope that it will be useful,
REM but WITHOUT ANY WARRANTY; without even the implied warranty of
REM MERCHANTABILITY OR FITNESS For A PARTICULAR PURPOSE. See the
REM GNU General Public License For more details.
REM You should have received a copy of the GNU General Public License
REM along with this program; if not, write to the Free Software
REM Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
CLEAR : DEFINT A-Z: ON ERROR GOTO TERROR
FCH$ = "LOTTO CHECK (C) 1994 Lorence Lombardo."
FCH2$ = "LOTTO CHECK (C) 1997 Lorence Lombardo."
PR$ = "LPT1:": LF$ = CHR$(10) + CHR$(13)
REM **********D( T ,N, L )**** ticket,number,line ****
REM NX=system GT= Games/ticket
TMX = 90: DIM D(TMX + 1, 25, 12), X$(TMX + 1), NX(TMX + 1), GT(TMX + 1), N(20), R(25), WN(25, 12), WL(12), K(7), E$(14), NC(45), WT(TMX), WTL(TMX, 12)
DEF SEG = 0: KF = PEEK(1047): POKE 1047, 0: GOSUB KEYDEF
MD$ = "": Z = 0: V = 0: SC = 1: N$ = "LC-DEF.DAT": ST = 1: GOSUB TLD
IF ST = 2 THEN P$ = "O": GOTO OPTIONS
ttop:
ST = 0: RR$ = "": FOR NN = 1 TO 8: N(NN) = 0: NEXT: NR = 0: M = 0: D = 0: B$ = "": XX2 = 8
WIDTH 40: GOSUB TITLE
DO
NR = NR + 1: G = NR: N1$ = " LOTTO ": IF MD$ = "4" THEN N1$ = " KENO "
IF NR > 6 AND MD$ <> "4" THEN RR$ = "SUPPLEMENTARY ": G = NR - 6
GN$ = STR$(G): IF MD$ = "2" AND NR = 6 THEN GN$ = "": RR$ = "POWER-BALL "
NR$ = N1$ + RR$ + "NUMBER" + GN$ + " IS"
TASK:
NRCH = 0: PRINT NR$: INPUT P$: PRINT
N(NR) = VAL(P$): IF UCASE$(P$) = "O" THEN P$ = "O": GOTO OPTIONS
IF UCASE$(P$) = "Q" THEN GOTO TEND
IF MD$ = "1" AND N(7) = 0 AND NR = 7 THEN NR = 6: EXIT DO
IF N(NR) < 1 OR N(NR) > GDMX THEN
BEEP: COLOR 4: PRINT " 1 TO"; GDMX; "ONLY MATE !!!": COLOR 7: PRINT : GOTO TASK
END IF
IF MD$ = "2" AND NR < 6 THEN GOSUB NCHECK
IF MD$ <> "2" THEN GOSUB NCHECK
IF NRCH = 1 THEN BEEP: COLOR 4: PRINT " YOU'VE ALREADY GOT THIS NUMBER MATE !!!": PRINT : COLOR 7: GOTO TASK
IF MD$ = "1" AND NR = 8 THEN EXIT DO
IF MD$ = "2" AND NR = 6 THEN EXIT DO
IF MD$ = "3" AND NR = 7 THEN EXIT DO
IF MD$ = "4" AND NR = 20 THEN EXIT DO
LOOP
IF MD$ = "4" THEN WIDTH 80: SC = 2: XX2 = 26
GOSUB TITLE: GOSUB NUMS: COLOR 6
PRINT "ARE YOU SURE THESE NUMBERS ARE CORRECT ? (Y/N/O)": COLOR 2
DO: B$ = UCASE$(INKEY$): IF B$ = "N" THEN GOTO ttop
IF B$ = "Y" THEN GOTO TSHW
IF B$ = "O" THEN GOTO OPTIONS
IF B$ = "Q" THEN GOTO TEND
LOOP
NCHECK:
FOR I = 1 TO NR: IF I <> NR AND N(NR) = N(I) THEN NRCH = 1
NEXT: RETURN
REM **************************** CHECKER **************************
TSHW: T = 0
DO: T = T + 1
IF V = 87 THEN LOCATE 20, XX2: COLOR 4: PRINT " SCANNING TICKETS "
TTSHOW:
SUSS = NX(T): GOSUB SYSUSS
IF V <> 87 THEN
SP = 4: SP$ = " ": IF MD$ = "1" OR MD$ = "3" THEN GOSUB MD1SC
IF MD$ = "2" THEN GOSUB MD2SC
CLS : GOSUB NUMS: COLOR 7: XX2 = 8: IF SC = 2 THEN XX2 = 26
PRINT SPC(XX2); X$(T) + SYS$ + " TICKET" + STR$(T): PRINT : COLOR 4
IF MD$ = "1" OR MD$ = "3" THEN PRINT SPACE$(NX(T) * SP + 7); "No's "; : COLOR 2
IF MD$ = "2" THEN
COLOR 5: PRINT SPACE$(NX(T) * SP + 2); "PB ";
IF NX(T) < 23 THEN COLOR 4: PRINT " No's";
END IF
IF MD$ = "4" THEN COLOR 2: PRINT SPACE$(48); "Spot"; : COLOR 4: PRINT " No's"
IF NR = 8 OR NR = 7 THEN PRINT "Sups"
IF NR = 6 THEN PRINT
PRINT
END IF
ANAL: WW = 0
FOR L = 1 TO GT(T): COLOR 9
IF V <> 87 THEN PRINT " "; CHR$(64 + L); " "; : COLOR 7
FOR N = 1 TO NX(T): WN(N, L) = 0
IF MD$ = "1" OR MD$ = "3" THEN GOSUB MD1
IF MD$ = "2" THEN GOSUB MD2
IF MD$ = "4" THEN M4 = D(T, 11, L): IF N <= M4 THEN GOSUB MD2
IF V <> 87 THEN
IF MD$ = "4" THEN SP$ = " ": IF D(T, N, L) = 0 THEN SP$ = "-"
IF D(T, N, L) < 10 THEN PRINT " ";
IF D(T, N, L) > 0 THEN PRINT SP$; STR$(D(T, N, L)); : COLOR 7
IF D(T, N, L) = 0 THEN PRINT " "; SP$;
IF MD$ = "2" AND N = NX(T) - 1 THEN COLOR 5: PRINT " ";
IF MD$ = "4" AND N = NX(T) - 1 THEN COLOR 2: PRINT " -";
END IF
NEXT N
WL(L) = 0: IF MD$ = "1" OR MD$ = "3" THEN GOSUB MD1CHK
IF MD$ = "2" THEN GOSUB MD2CHK
IF MD$ = "4" THEN GOSUB MD4CHK
IF V <> 87 AND WL(L) = 1 THEN
IF NX(T) < 23 THEN PRINT " "; : COLOR 30, 6: PRINT " $$ ";
XXX = POS(0): LOCATE , 2: COLOR 30, 0: PRINT CHR$(64 + L);
LOCATE , XXX
ELSE
IF V <> 87 THEN IF NX(T) < 23 THEN PRINT " ";
END IF
IF V <> 87 THEN
IF M = 0 AND MD$ <> "2" THEN PRINT " ";
IF M > 0 AND NX(T) < 23 THEN COLOR 4: PRINT M;
IF D > 0 AND MD$ <> "2" THEN COLOR 2: PRINT " "; D;
COLOR 7: PRINT
END IF: M = 0: D = 0
NEXT L
IF WW = 1 AND V <> 87 THEN
LOCATE 5, 5: COLOR 31, 6: PRINT " WINNER !!! ": COLOR , 0
FOR W = 1 TO 5: BEEP: NEXT W: TTT = T
END IF
IF Z$ = "-" AND V = 87 AND WW = 0 THEN
IF T > 1 THEN T = T - 1: GOTO TTSHOW
IF T = 1 THEN Z$ = "": V = 99: T = TTT: BEEP: LOCATE 20, 25: PRINT SPACE$(25)
END IF
IF V <> 87 THEN
LOCATE 21, XX2 + 3: COLOR 5: PRINT "- "; : COLOR 6: PRINT "previous "; : COLOR 5
PRINT "Space "; : COLOR 6: PRINT "next": COLOR 5
LOCATE 22, XX2 + 2: PRINT "R "; : COLOR 6: PRINT "reset "; : COLOR 5: PRINT "F ";
COLOR 6: PRINT "first "; : COLOR 5: PRINT "L "; : COLOR 6: PRINT "last": COLOR 5
LOCATE 23, XX2: PRINT "G "; : COLOR 6: PRINT "goto "; : COLOR 5: PRINT "P ";
COLOR 6: PRINT "print wins "; : COLOR 5: PRINT "Q "; : COLOR 6: PRINT "quit"
END IF
IF V = 87 OR V = 99 THEN
IF T = TT THEN
IF WW = 0 OR V = 99 THEN COLOR 4: LOCATE 20, 31: BEEP: PRINT "ALL TICKETS SCANNED"
IF WW = 0 THEN T = TTT: V = 99
END IF
END IF
DO: IF V = 87 THEN EXIT DO
Z$ = UCASE$(INKEY$): IF Z$ = " " AND T <> TT THEN EXIT DO:
IF Z$ = "-" AND T > 1 THEN
IF V = 99 THEN V = 87
IF V = 87 THEN LOCATE 20, 30: COLOR 4: PRINT " BACK SCAN "
T = T - 1: GOTO TTSHOW
END IF
IF Z$ = "L" AND T < TT THEN T = TT: GOTO TTSHOW
IF Z$ = "F" AND T > 1 THEN
IF V = 99 THEN V = 87
GOTO TSHW
END IF
IF Z$ = "R" OR Z$ = CHR$(27) THEN V = 0: GOTO ttop
IF Z$ = "P" AND WW = 1 THEN GOSUB WPRINT
IF Z$ = "G" THEN
IF V = 87 THEN V = 99
TTT = T: CLS : GOSUB TGOT: GOTO TTSHOW
END IF
IF Z$ = "Q" THEN GOTO TEND
LOOP: IF V = 87 AND WW = 1 THEN V = 99: GOTO TTSHOW
IF V = 99 THEN V = 87
LOOP
TITLE:
CLS : COLOR 7, 5: PRINT " LOTTO CHECK version 2.0b (C) 1997 Lorence Lombardo. "
IF B$ <> "O" AND P$ <> "O" AND XX2 <> 26 THEN COLOR 0, 15: PRINT : PRINT " Enter 'O' for options and 'Q' to quit. "
COLOR 7, 0: PRINT : RETURN
NUMS:
COLOR 4: PRINT " "; : FOR NN = 1 TO NR
IF MD$ <> "4" AND NN > 6 THEN COLOR 2
IF MD$ = "2" AND NN = NR THEN COLOR 2
PRINT STR$(N(NN)); : IF MD$ <> "4" AND NN < NR THEN PRINT " -";
NEXT: PRINT : PRINT : RETURN
MD1:
FOR NN = 1 TO NR
IF N(NN) = D(T, N, L) AND NN < 7 THEN COLOR 4: M = M + 1: WN(N, L) = 1
IF N(NN) = D(T, N, L) AND NN > 6 THEN COLOR 2: D = D + 1: WN(N, L) = 2
NEXT NN: RETURN
MD1CHK:
MM = M: IF NX(T) < 6 THEN MM = M + 6 - NX(T)
IF NR = 8 OR NR = 7 THEN IF MM = 3 AND D > 0 OR MM > 3 THEN WW = 1: WL(L) = 1
IF NR = 6 AND MM = 6 THEN WW = 1: WL(L) = 1
RETURN
MD1SC:
IF NX(T) > 6 AND NX(T) < 9 OR NX(T) > 15 THEN SP$ = "": SP = 3
IF NX(T) > 8 AND SC <> 2 THEN SC = 2: WIDTH 80
IF NX(T) < 9 AND SC <> 1 THEN SC = 1: WIDTH 40
RETURN
MD2:
FOR NN = 1 TO NR
IF N(NN) = D(T, N, L) AND N <> NX(T) AND NN <> NR THEN COLOR 4: M = M + 1: WN(N, L) = 1
IF N(NN) = D(T, N, L) AND N = NX(T) AND NN = NR THEN COLOR 2: D = D + 1: WN(N, L) = 1
NEXT NN: RETURN
MD2CHK:
MM = M: IF NX(T) < 6 THEN MM = M + 6 - NX(T)
IF MM = 2 AND D > 0 OR MM > 2 THEN WW = 1: WL(L) = 1
RETURN
MD2SC:
IF NX(T) > 6 AND NX(T) < 10 OR NX(T) > 16 THEN SP$ = "": SP = 3
IF NX(T) > 9 AND SC <> 2 THEN SC = 2: WIDTH 80
IF NX(T) < 10 AND SC <> 1 THEN SC = 1: WIDTH 40
RETURN
MD4:
FOR NN = 1 TO NR
IF N(NN) = D(T, N, L) THEN COLOR 4: M = M + 1: WN(N, L) = 1
NEXT NN: RETURN
MD4CHK:
IF M4 = 10 THEN IF M = 0 OR M > 6 THEN WW = 1: WL(L) = 1
IF M4 = 9 OR M4 = 8 THEN IF M > 5 THEN WW = 1: WL(L) = 1
IF M4 = 7 OR M4 = 6 THEN IF M > 4 THEN WW = 1: WL(L) = 1
IF M4 = 5 AND M > 3 THEN WW = 1: WL(L) = 1
IF M4 = 4 AND M > 2 THEN WW = 1: WL(L) = 1
IF M4 = 3 AND M > 1 THEN WW = 1: WL(L) = 1
RETURN
SYSUSS:
SYS$ = " standard": SY = 0: IF MD$ = "2" THEN SY = 1
SY$ = STR$(SUSS - SY): IF MD$ <> "2" AND SUSS < 6 THEN SYS$ = " take" + SY$
IF MD$ <> "2" AND SUSS > 6 THEN SYS$ = " system" + SY$
IF MD$ = "2" AND SUSS <> 6 THEN SYS$ = " PowerPlay" + SY$
IF MD$ = "4" THEN SYS$ = " keno"
RETURN
REM ********************************* WIN PRINT *****************************
WPRINT:
OPEN PR$ FOR OUTPUT AS 1
PRINT #1, X$(T); SYS$; " ticket"; T
SPP$ = " ": IF NX(T) = 20 THEN SPP$ = ""
FOR L = 1 TO GT(T)
IF WL(L) = 1 THEN
PRINT #1, " "; CHR$(64 + L); " ";
FOR N = 1 TO NX(T)
IF WN(N, L) = 0 THEN WP$ = " --"
IF MD$ = "4" AND N > D(T, 11, L) THEN WP$ = " "
IF WN(N, L) > 0 THEN
IF D(T, N, L) < 10 THEN WP$ = " " + STR$(D(T, N, L))
IF D(T, N, L) > 9 THEN WP$ = STR$(D(T, N, L))
END IF
PRINT #1, WP$; SPP$;
IF MD$ = "2" AND N = NX(T) - 1 THEN PRINT #1, " PB";
IF MD$ = "4" AND N = NX(T) - 1 THEN PRINT #1, " Spot"; D(T, 11, L)
NEXT N: PRINT #1, "": PRINT #1, " ";
FOR N = 1 TO NX(T)
IF WN(N, L) = 2 THEN PRINT #1, " ~~"; SPP$; ELSE PRINT #1, " "; SPP$;
NEXT N: PRINT #1, ""
END IF
NEXT L: PRINT #1, "": CLOSE #1: BEEP: RETURN
REM **************************** OPTIONS ************************************
OPTIONS:
WIDTH 40: ST = 0: GOSUB TITLE: COLOR 0, 15: PRINT " OPTIONS MENU ": COLOR 2, 0
LOCATE 7, 8: COLOR 4: PRINT "L "; : COLOR 2: PRINT "Load a new data file"
LOCATE 9, 8: COLOR 4: PRINT "E "; : COLOR 2: PRINT "Ticket editor"
LOCATE 11, 8: COLOR 4: PRINT "R "; : COLOR 2: PRINT "Create random tickets"
LOCATE 13, 8: COLOR 4: PRINT "C "; : COLOR 2: PRINT "Return to checker"
LOCATE 15, 8: COLOR 4: PRINT "W "; : COLOR 2: PRINT "Show winning tickets only"
LOCATE 18, 8: COLOR 5: PRINT "A "; : COLOR 2: PRINT "About "; : COLOR 5: PRINT "Q "; : COLOR 2: PRINT "Quit"
ask1: V$ = UCASE$(INKEY$): IF V$ = "" THEN GOTO ask1
V = ASC(V$)
IF V = 69 THEN GOTO TSCREEN
IF V = 76 THEN KA = 2: WIDTH 80: GOSUB TL1: WIDTH 40: IF N$ <> "" THEN GOTO SUSS ELSE GOTO OPTIONS
IF V$ = "R" THEN CLS : GOTO TRANDOM: REM V=82
IF V = 67 OR V = 27 THEN GOTO SUSS
IF V = 81 THEN GOTO TEND
IF V = 87 THEN GOTO SUSS
IF V = 65 THEN GOTO ABOUT
GOTO ask1
SUSS:
ER$ = "check..!!"
IF TT = 0 THEN
BEEP: CLS : LOCATE 12, 12: COLOR 4: PRINT "Nothing to "; ER$
GOSUB PAUSE: GOTO OPTIONS
END IF
IF P$ = "O" THEN P$ = "": GOTO ttop
IF B$ = "O" THEN B$ = "": GOTO TSHW
REM ****************************** RANDOM **********************************
TRANDOM:
IF MD$ = "" THEN MD$ = "1": GOSUB TLIMITS
COLOR 7: INPUT " How many tickets "; GG: COLOR 4
IF GG > TMX THEN BEEP: PRINT " No more than"; TMX: PRINT : GOTO TRANDOM
IF GG < 1 THEN GOTO OPTIONS
CLS : LOCATE 12, 12: PRINT "Creating tickets.": GOSUB TEDIT: TT = GG
FOR T = 1 TO TT: GT(T) = GPT: NX(T) = 6: GOSUB TTRND: NEXT T
BEEP: GOTO TSCREEN
TTRND:
X$(T) = "RANDOM": FOR L = 1 TO GT(T): GOSUB RGAME: NEXT L: RETURN
RGAME:
RMX = NX(T): IF MD$ = "4" THEN RMX = D(T, 11, L): IF RMX < 3 THEN RMX = 3: D(T, 11, L) = 3
FOR R = 1 TO RMX
TRND:
RDCH = 0: RANDOMIZE TIMER: R(R) = (RND * (GDMX - 1)) + 1
IF MD$ = "2" AND R <> NX(T) THEN GOSUB RDCHECK
IF MD$ <> "2" THEN GOSUB RDCHECK
IF RDCH = 1 THEN GOTO TRND
NEXT R: GOSUB RSORT: RETURN
RDCHECK:
FOR S = 1 TO R: IF S <> R AND R(R) = R(S) THEN RDCH = 1
NEXT S: RETURN
REM ****************************** EDITOR **********************************
TEDIT:
FOR T = 1 TO TT: TZ = T: GOSUB TZERO: NX(T) = 0: GT(T) = 0: NEXT T
IF KA = 2 THEN RETURN
N = 1: L = 1: TT = 0: IF V = 82 THEN RETURN
TSCREEN:
IF MD$ = "" THEN MD$ = "1"
WIDTH 80: Z4 = 0: T = 1: IF TT = 0 THEN TT = 1
GOSUB LAYOUT: GOSUB TICKET
MAIN:
V = 0: Z = 0: Z3 = 0: Z2 = PEEK(1047)
FOR CR = 0 TO 7: IF Z2 = K(CR) + 4 THEN Z3 = 2
IF Z2 = K(CR) + 8 OR Z2 = K(CR) + 12 THEN Z3 = 1
NEXT CR
IF Z3 = 1 AND Z4 = 2 AND MD$ <> "2" THEN GOSUB BLANK: GOSUB ALT
IF Z3 = 2 AND Z4 = 1 AND MD$ <> "2" THEN GOSUB BLANK: GOSUB CTRL
A$ = UCASE$(INKEY$): IF A$ = "" THEN GOTO PSY
Z = ASC(A$)
REM **** AN ARROW ****
IF A$ = U$ OR A$ = D$ OR A$ = L$ OR A$ = R$ THEN
GOSUB DCHECK
IF DCH = 0 THEN
C$ = "-": IF MD$ = "2" OR MD$ = "4" THEN IF N = NX(T) THEN C$ = "="
C = 3: GOSUB POSY
IF A$ = D$ THEN L = L + 1: IF L > GT(T) THEN L = 1
IF A$ = U$ THEN L = L - 1: IF L < 1 THEN L = GT(T)
IF A$ = R$ THEN N = N + 1: IF N > NX(T) THEN N = 1
IF MD$ = "4" AND N > D(T, 11, L) THEN N = 11
IF A$ = L$ THEN
IF MD$ = "4" AND N = 11 THEN N = D(T, 11, L) ELSE N = N - 1
IF N < 1 THEN N = NX(T)
END IF
END IF
END IF
REM *** A NUMBER ***
IF Z > 47 AND Z < 58 THEN
IF D(T, N, L) > 0 THEN
X = -1: C$ = STR$(D(T, N, L)) + A$
NVL = GDMX + 1: IF MD$ = "4" AND N = 11 THEN NVL = 11
IF VAL(C$) < NVL THEN GOSUB NUM: D(T, N, L) = VAL(C$)
END IF
IF D(T, N, L) = 0 THEN
D(T, N, L) = VAL(A$): C$ = A$: X = 1
IF D(T, N, L) > 0 THEN GOSUB NUM
END IF
END IF
IF A$ = DL$ OR Z = 8 THEN
Y = -1: C = 7: X = 1
IF D(T, N, L) < 10 THEN C$ = " ": GOSUB NUM: D(T, N, L) = 0
IF D(T, N, L) > 9 THEN
C$ = " " + LEFT$(STR$(D(T, N, L)), 2): X = -1
GOSUB NUM: D(T, N, L) = VAL(C$)
END IF
END IF
IF A$ = "+" AND T < TMX THEN
GOSUB DCHECK: GOSUB CHECK
IF DCH = 0 AND CH > 0 THEN
DD$ = X$(T): T = T + 1: IF X$(T) = "" AND T > TT THEN X$(T) = DD$
GOSUB LAYOUT: GOSUB TICKET
END IF
END IF
IF TT < T THEN TT = T
IF A$ = "-" AND T > 1 THEN GOSUB DCHECK: IF DCH = 0 THEN T = T - 1: GOSUB LAYOUT: GOSUB TICKET
IF Z = 13 AND Z3 <> 2 THEN GOTO TNAME
IF A$ = "Q" THEN
LLL = L: NNN = N: COLOR 4: CLS : LOCATE 12, 15
PRINT "Are you sure you want to quit ? (Y/N)": GOSUB CONFIRM
IF E$ = "N" THEN KA = 2: GOSUB LAYOUT: GOSUB TICKET: L = LLL: N = NNN: KA = 0: GOTO MAIN
IF E$ = "Y" THEN GOTO TEND
END IF
IF A$ = "S" THEN GOTO TSORT
IF A$ = S$ + "&" THEN GOTO TLOAD
IF A$ = S$ + CHR$(31) THEN GOTO TSAVE
IF A$ = S$ + "1" THEN
KA = 4: LLL = L: NNN = N: GOSUB CHECK
IF TT = 1 AND CH > 0 OR TT > 1 THEN
COLOR 4: CLS : LOCATE 12, 15
PRINT "All existing data will be lost. Continue ? (Y/N)": GOSUB CONFIRM
IF E$ = "N" THEN KA = 2: GOSUB LAYOUT: GOSUB TICKET: L = LLL: N = NNN: KA = 0: GOTO MAIN
END IF: GOSUB TEDIT: KA = 0
END IF
IF A$ = "F" AND T > 1 THEN T = 1: GOSUB LAYOUT: GOSUB TICKET
IF A$ = "L" AND T < TT THEN
TTT = T: T = TT: GOSUB CHECK
IF CH = 0 THEN T = T - 1
IF TTT <> T THEN GOSUB LAYOUT: GOSUB TICKET
END IF
IF A$ = "G" THEN GOTO TGOTO
IF A$ = PT$ THEN GOSUB CHECK: IF CH > 0 THEN GOTO TPRT
IF A$ = S$ + CHR$(23) THEN GOTO TINSERT
IF A$ = S$ + "%" THEN GOTO TERASE
IF A$ = S$ + "," THEN TZ = T: GOSUB TZERO: GOSUB LAYOUT
IF A$ = S$ + "-" THEN TZ = 0: GOSUB TZERO: TA = 0: TB = T: GOSUB TCOPY: BEEP
IF A$ = S$ + "0" THEN
TZ = T: GOSUB TZERO: TA = T: TB = 0: GOSUB TCOPY
GOSUB LAYOUT: GOSUB TICKET
END IF
IF A$ = S$ + CHR$(17) THEN
TZ = TMX + 1: GOSUB TZERO: TA = TZ: TB = 0: GOSUB TCOPY
TZ = 0: GOSUB TZERO: TA = 0: TB = T: GOSUB TCOPY
TZ = T: GOSUB TZERO: TA = T: TB = TMX + 1: GOSUB TCOPY
GOSUB LAYOUT: GOSUB TICKET
END IF
IF Z = 15 OR Z = 27 THEN
GOSUB DCHECK
IF DCH = 0 THEN
T = TT: GOSUB CHECK: IF CH = 0 THEN TT = TT - 1
COLOR 0, 0: GOTO OPTIONS
END IF
END IF
IF Z3 = 2 AND Z = 13 THEN
KA = 4: LLL = L: NNN = N: GOSUB CHECK: LOCATE 1, 1
IF TT = 1 AND CH > 0 OR TT > 1 THEN
COLOR 4: CLS : LOCATE 12, 15
PRINT "Changing mode will clear all data. Continue ? (Y/N)"
PRINT : GOSUB CONFIRM
IF E$ = "N" THEN KA = 2: GOSUB LAYOUT: GOSUB TICKET: L = LLL: N = NNN: KA = 0: GOTO MAIN
END IF: COLOR 7
PRINT SPACE$(18); "Select mode. ("; : COLOR 4: PRINT "P"; : COLOR 7
PRINT "ools/"; : COLOR 4: PRINT "L"; : COLOR 7: PRINT "otto/Power"; : COLOR 4
PRINT "B"; : COLOR 7: PRINT "all/"; : COLOR 4: PRINT "K"; : COLOR 7: PRINT "eno)"
DO: E$ = UCASE$(INKEY$)
IF E$ = "P" OR E$ = "L" OR E$ = "B" OR E$ = "K" THEN EXIT DO
LOOP
IF E$ = "L" THEN MD$ = "1"
IF E$ = "B" THEN MD$ = "2"
IF E$ = "P" THEN MD$ = "3"
IF E$ = "K" THEN MD$ = "4"
GOSUB TEDIT: KA = 0
END IF
IF A$ = S$ + CHR$(19) THEN
LOCATE 23, 30: COLOR 4: PRINT " Creating ticket. "
GOSUB TTRND: GOSUB LAYOUT: GOSUB TICKET
END IF
IF A$ = PA$ THEN GOTO TPRINT
IF Z = 7 THEN GOTO GMTT
IF Z = 19 AND MD$ <> "4" THEN GOTO TSYSTEM
IF Z = 18 THEN Y = -1: C = 7: NN = N: GOSUB RGAME: GOSUB LIN: N = NN
IF Z = 26 THEN
TZ = T: LL = L: GOSUB GZERO: NN = N: Y = -1: C = 7: GOSUB LIN: N = NN
END IF
IF Z = 16 THEN
GCH = 0: FOR NN = 1 TO NX(T): IF D(T, NN, L) > 0 THEN GCH = 1
NEXT NN: IF GCH = 1 THEN GOTO TPRT
END IF
IF Z = 24 THEN
TZ = 0: LL = 0: GOSUB GZERO: LB = L: TA = 0: TB = T: NC = NX(T)
GOSUB GCOPY: BEEP
END IF
IF Z = 2 THEN
TZ = T: LL = L: GOSUB GZERO: TA = T: TB = 0: LB = 0: NC = NX(T)
GOSUB GCOPY: NN = N: Y = -1: C = 7: GOSUB LIN: N = NN
END IF
IF Z = 23 THEN
NC = NX(T): TA = T: LL = 0: TB = T: LB = L: GOSUB GCOPY: TZ = T: LL = L
GOSUB GZERO: TB = 0: LB = 0: GOSUB GCOPY: TZ = 0: LL = 0: GOSUB GZERO
TB = T: TA = 0: GOSUB GCOPY: TZ = T: GOSUB GZERO
NN = N: Y = -1: C = 7: GOSUB LIN: N = NN
END IF
IF Z = 11 THEN GOTO GERASE
IF Z = 9 AND Z3 = 2 AND GT(T) < GPT THEN GOTO GINSERT
REM *************************
PSY:
IF MD$ = "4" AND D(T, 11, L) < 3 THEN N = 11
C = 30: C$ = "^": X = 1: Y = 0: GOSUB POSY: GOTO MAIN
NUM:
C = 7: Y = -1: IF MD$ = "2" AND N = NX(T) THEN C = 4
IF MD$ = "4" AND N = NX(T) THEN C = 5
POSY:
LOCATE Y + (L * 2), X + (N * 3): COLOR C: PRINT C$; : RETURN
TLIMITS:
IF NX(T) = 0 THEN NX(T) = 6
IF MD$ = "1" OR MD$ = "2" THEN GDMX = 45
IF MD$ = "3" THEN GDMX = 38
IF MD$ = "4" THEN GDMX = 80: GPT = 5: NX(T) = 11
IF MD$ = "1" OR MD$ = "3" THEN GPT = 12
IF MD$ = "2" THEN GPT = 6
IF GT(T) = 0 THEN GT(T) = GPT
RETURN
LAYOUT:
GOSUB TLIMITS
COLOR 0, 0: CLS : FOR K = 1 TO GT(T): COLOR 5: PRINT CHR$(64 + K)
COLOR 3: PRINT " "; : FOR kk = 1 TO NX(T): QQ$ = " --"
IF MD$ = "2" OR MD$ = "4" THEN IF kk = NX(T) THEN QQ$ = " =="
PRINT QQ$; : NEXT kk
IF K < 12 THEN PRINT
NEXT K: COLOR 2
IF MD$ = "2" THEN GOSUB PBLAYOUT ELSE GOSUB TLAYOUT
RETURN
TLAYOUT:
IF MD$ = "1" THEN MDN$ = "Lotto"
IF MD$ = "3" THEN MDN$ = "Pools"
IF MD$ = "4" THEN MDN$ = "Keno"
LOCATE 1, 63: PRINT MDN$; " ticket"; T: COLOR 13: LOCATE 2, 64: PRINT "NAME: "; : COLOR 6: PRINT X$(T)
SUSS = NX(T): GOSUB SYSUSS: LOCATE 3, 64: COLOR 13: PRINT "TYPE:"; : COLOR 6: PRINT SYS$
LOCATE 4, 64: COLOR 13: PRINT "GAMES:"; : COLOR 6: PRINT GT(T)
LOCATE 5, 63: COLOR 1, 15: PRINT " KEY COMMANDS ": COLOR 6, 0
LOCATE 6, 63: PRINT "+ "; : COLOR 2: PRINT "next "; : COLOR 6: PRINT "- "; : COLOR 2: PRINT "previous": COLOR 6
LOCATE 7, 63: COLOR 6: PRINT "F "; : COLOR 2: PRINT "first "; : COLOR 6: PRINT "L "; : COLOR 2: PRINT "last"; : COLOR 6
LOCATE 8, 63: PRINT "G "; : COLOR 2: PRINT "goto"; : COLOR 6: PRINT " Del "; : COLOR 2: PRINT "del # "; : COLOR 6
LOCATE 9, 63: PRINT "S"; : COLOR 2: PRINT " sort "; : COLOR 6: PRINT "Enter "; : COLOR 2: PRINT "name ";
LOCATE 10, 63: COLOR 6: PRINT "Arws "; : COLOR 2: PRINT "curs "; : COLOR 6: PRINT "Q "; : COLOR 2: PRINT "quit"
IF Z4 < 2 THEN GOSUB ALT ELSE GOSUB CTRL
RETURN
ALT:
LOCATE 12, 63: COLOR 15: PRINT "[ALT] KEYS:- ": COLOR 6: Z4 = 1
LOCATE 13, 63: PRINT "L "; : COLOR 2: PRINT "load "; : COLOR 6: PRINT "S "; : COLOR 2: PRINT "save": COLOR 6
LOCATE 14, 63: PRINT "N "; : COLOR 2: PRINT "new "; : COLOR 6: PRINT "A "; : COLOR 2: PRINT "print all"
LOCATE 15, 63: COLOR 7: PRINT "Ticket:-": B2$ = "[Ctrl]": GOSUB FUNS: RETURN
CTRL:
LOCATE 12, 63: COLOR 15: PRINT "[CTRL] KEYS:-": COLOR 6: Z4 = 2
LOCATE 13, 63: IF MD$ <> "4" THEN PRINT "S "; : COLOR 2: PRINT "system ";
COLOR 6: PRINT "G "; : COLOR 2: PRINT "games": COLOR 6
LOCATE 14, 63: PRINT "O "; : COLOR 2: PRINT "options "; : COLOR 6: PRINT "M "; : COLOR 2: PRINT "mode"
LOCATE 15, 63: COLOR 7: PRINT "Game:-": B2$ = "[Alt]": GOSUB FUNS: RETURN
FUNS:
LOCATE 16, 63: COLOR 6: PRINT "X "; : COLOR 2: PRINT "copy "; : COLOR 6: PRINT "B "; : COLOR 2: PRINT "paste": COLOR 6
LOCATE 17, 63: PRINT "W "; : COLOR 2: PRINT "swap "; : COLOR 6: PRINT "P "; : COLOR 2: PRINT "print": COLOR 6
LOCATE 18, 63: PRINT "Z "; : COLOR 2: PRINT "zero "; : COLOR 6: PRINT "R "; : COLOR 2: PRINT "random": COLOR 6
LOCATE 19, 63: PRINT "K "; : COLOR 2: PRINT "kill "; : COLOR 6: PRINT "I "; : COLOR 2: PRINT "insert"
LOCATE 21, 63: COLOR 9: PRINT "Press "; : COLOR 14: PRINT B2$; : COLOR 9: PRINT " for "
LOCATE 22, 63: PRINT " more fuctions.": RETURN
BLANK:
COLOR 0, 0: FOR B1 = 1 TO 4: LOCATE 11 + B1, 63: PRINT SPACE$(18): NEXT B1: RETURN
PBLAYOUT:
LOCATE 14, 31: COLOR 0, 15: PRINT " PowerBall mode "
PBX = 11: LOCATE 16, 34: COLOR 13, 0: PRINT "Ticket"; T
LOCATE 16, PBX: PRINT "NAME: "; : COLOR 6: PRINT X$(T): SUSS = NX(T): GOSUB SYSUSS
LOCATE 17, PBX: COLOR 13: PRINT "TYPE:"; : COLOR 6: PRINT SYS$
LOCATE 18, PBX: COLOR 13: PRINT "GAMES:"; : COLOR 6: PRINT GT(T)
LOCATE 19, PBX: COLOR 1, 15: PRINT " KEY COMMANDS ": COLOR 6, 0
LOCATE 20, PBX: PRINT "+ "; : COLOR 2: PRINT "next "; : COLOR 6: PRINT "- "; : COLOR 2: PRINT "previous": COLOR 6
LOCATE 21, PBX: COLOR 6: PRINT "F "; : COLOR 2: PRINT "first "; : COLOR 6: PRINT "L "; : COLOR 2: PRINT "last"; : COLOR 6
LOCATE 22, PBX: PRINT "G "; : COLOR 2: PRINT "goto"; : COLOR 6: PRINT " Del "; : COLOR 2: PRINT "del # "; : COLOR 6
LOCATE 23, PBX: PRINT "S"; : COLOR 2: PRINT " sort "; : COLOR 6: PRINT "Enter "; : COLOR 2: PRINT "name ";
LOCATE 24, PBX: COLOR 6: PRINT "Arws "; : COLOR 2: PRINT "curs "; : COLOR 6: PRINT "Q "; : COLOR 2: PRINT "quit";
LOCATE 17, PBX + 20: COLOR 15: PRINT "[ALT] KEYS:- ": COLOR 6
LOCATE 18, PBX + 20: PRINT "L "; : COLOR 2: PRINT "load "; : COLOR 6: PRINT "S "; : COLOR 2: PRINT "save": COLOR 6
LOCATE 19, PBX + 20: PRINT "N "; : COLOR 2: PRINT "new "; : COLOR 6: PRINT "A "; : COLOR 2: PRINT "print all"
LOCATE 20, PBX + 20: COLOR 7: PRINT "Ticket:-"
LOCATE 21, PBX + 20: COLOR 6: PRINT "X "; : COLOR 2: PRINT "copy "; : COLOR 6: PRINT "B "; : COLOR 2: PRINT "paste": COLOR 6
LOCATE 22, PBX + 20: PRINT "W "; : COLOR 2: PRINT "swap "; : COLOR 6: PRINT "P "; : COLOR 2: PRINT "print": COLOR 6
LOCATE 23, PBX + 20: PRINT "Z "; : COLOR 2: PRINT "zero "; : COLOR 6: PRINT "R "; : COLOR 2: PRINT "random": COLOR 6
LOCATE 24, PBX + 20: PRINT "K "; : COLOR 2: PRINT "kill "; : COLOR 6: PRINT "I "; : COLOR 2: PRINT "insert";
LOCATE 17, PBX + 40: COLOR 15: PRINT "[CTRL] KEYS:-": COLOR 6
LOCATE 18, PBX + 40: PRINT "S "; : COLOR 2: PRINT "system"; : COLOR 6: PRINT " G "; : COLOR 2: PRINT "games": COLOR 6
LOCATE 19, PBX + 40: PRINT "O "; : COLOR 2: PRINT "options "; : COLOR 6: PRINT "M "; : COLOR 2: PRINT "mode"
LOCATE 20, PBX + 40: COLOR 7: PRINT "Game:-"
LOCATE 21, PBX + 40: COLOR 6: PRINT "X "; : COLOR 2: PRINT "copy "; : COLOR 6: PRINT "B "; : COLOR 2: PRINT "paste": COLOR 6
LOCATE 22, PBX + 40: PRINT "W "; : COLOR 2: PRINT "swap "; : COLOR 6: PRINT "P "; : COLOR 2: PRINT "print": COLOR 6
LOCATE 23, PBX + 40: PRINT "Z "; : COLOR 2: PRINT "zero "; : COLOR 6: PRINT "R "; : COLOR 2: PRINT "random": COLOR 6
LOCATE 24, PBX + 40: PRINT "K "; : COLOR 2: PRINT "kill "; : COLOR 6: PRINT "I "; : COLOR 2: PRINT "insert";
RETURN
DCHECK:
DCH = 0
IF MD$ = "4" AND N = NX(T) THEN
M4 = D(T, 11, L): IF M4 = 0 AND A$ = "-" THEN RETURN
IF M4 < 3 THEN DCH = 1: DCH$ = "Invalid spot number.": GOSUB DCHPR
IF M4 > 2 AND M4 < 10 THEN
FOR NN = M4 + 1 TO 10: D(T, NN, L) = 0: NEXT
NN = N: Y = -1: GOSUB LIN: N = NN: Y = 0: X = 1
END IF
RETURN
ELSE
IF D(T, N, L) = 0 THEN RETURN
END IF
IF MD$ = "2" AND N = NX(T) THEN RETURN
NXT = NX(T): IF MD$ = "2" OR MD$ = "4" THEN NXT = NX(T) - 1
FOR NCH = 1 TO NXT: IF N <> NCH AND D(T, N, L) = D(T, NCH, L) THEN DCH = 1
NEXT NCH
IF DCH = 1 THEN DCH$ = "DUPLICATE NUMBER": GOSUB DCHPR
RETURN
DCHPR:
BEEP: COLOR 4: CLS : LOCATE 12, 30: PRINT DCH$: GOSUB PAUSE: KA = 2: NNN = N
LLL = L: GOSUB LAYOUT: GOSUB TICKET: N = NNN: L = LLL: KA = 0: RETURN
KEYDEF:
S$ = CHR$(0): U$ = S$ + "H": D$ = S$ + "P": L$ = S$ + "K": R$ = S$ + "M"
DL$ = S$ + "S": K(0) = 0: K(1) = 64: K(2) = 96: K(3) = 112: K(4) = 48
K(5) = 16: K(6) = 32: K(7) = 80: PA$ = S$ + CHR$(30): PT$ = S$ + CHR$(25)
FERROR:
E$(0) = "<": E$(1) = ">": E$(2) = ".": E$(3) = CHR$(34): E$(4) = "|"
E$(5) = "+": E$(6) = "=": E$(7) = ";": E$(8) = "?": E$(9) = "/": E$(10) = "["
E$(11) = "]": E$(12) = ":": E$(13) = " ": E$(14) = "*": RETURN
TICKET:
FOR L = 1 TO GT(T): GOSUB LIN: NEXT L: N = 1: L = 1: RETURN
LIN:
FOR N = 1 TO NX(T): X = 0: IF D(T, N, L) > 9 THEN X = -1
C$ = STR$(D(T, N, L)): IF D(T, N, L) = 0 THEN C$ = " "
GOSUB NUM
NEXT N: RETURN
CHECK:
CH = 0: NN = N: LL = L: FOR L = 1 TO GT(T)
FOR N = 1 TO NX(T): IF D(T, N, L) > CH THEN CH = D(T, N, L)
NEXT N: NEXT L: N = NN: L = LL: RETURN
TNAME:
NNN = N: LLL = L: COLOR 2: CLS
TNM:
INPUT "Enter name "; X$(T)
IF LEN(X$(T)) > 10 THEN BEEP: COLOR 4: PRINT : PRINT "No more than 10 characters long.": COLOR 2: PRINT : GOTO TNM
GOSUB LAYOUT: GOSUB TICKET: N = NNN: L = LLL: GOTO MAIN
GMTT:
COLOR 2: CLS : NNN = N: LLL = L
GMT:
INPUT "Enter number of games "; GGG
GPT$ = "No more than" + STR$(GPT) + " games per ticket."
IF GGG < 1 THEN GOSUB LAYOUT: GOSUB TICKET: N = NNN: L = LLL: GOTO MAIN
IF GGG > GPT THEN BEEP: COLOR 4: PRINT : PRINT GPT$: COLOR 2: PRINT : GOTO GMT
TZ = T: GOSUB TZERO: L = 1: N = 1: GT(T) = GGG: GOSUB LAYOUT: GOTO MAIN
TSYSTEM:
COLOR 2: CLS : LLL = L: NNN = N
TSYS:
INPUT "Enter ticket system "; NXX
IF MD$ = "1" OR MD$ = "3" THEN NXMN = 4: NXMX = 20
IF MD$ = "2" THEN NXMN = 3: NXMX = 24
NX$ = "Systems are no less than" + STR$(NXMN) + " and no more than" + STR$(NXMX)
IF NXX < 1 THEN GOSUB LAYOUT: GOSUB TICKET: L = LLL: N = NNN: GOTO MAIN
IF NXX < NXMN OR NXX > NXMX THEN BEEP: COLOR 4: PRINT : PRINT NX$: PRINT : COLOR 2: GOTO TSYS
IF MD$ = "2" THEN NXX = NXX + 1
TZ = T: GOSUB TZERO: L = 1: N = 1: NX(T) = NXX: GOSUB LAYOUT: GOTO MAIN
TSAVE:
TTT = T: T = TT: GOSUB CHECK: TS = TT: IF CH = 0 THEN TS = TT - 1
T = TTT: GOSUB DCHECK: IF DCH = 1 OR TS = 0 THEN KA = 0: GOTO MAIN
TSV:
SV = 1: FL$ = " Save as default data file `LC-DEF.DAT' (Y/N/Esc)"
N$ = "LC-DEF.DAT": GOSUB FNAME
IF N$ = "" THEN
IF KA = 2 THEN GOTO TL1
GOTO tse
END IF
GOSUB FCHECK: IF E$ = "N" THEN GOTO TSV
tsv2:
CLS : LOCATE 12, 35: PRINT "SAVING": OPEN N$ FOR OUTPUT AS #1: PRINT #1, FCH2$
WRITE #1, VAL(MD$), TS: FOR T = 1 TO TS: PRINT #1, X$(T); ","; : WRITE #1, GT(T), NX(T)
FOR L = 1 TO GT(T): FOR N = 1 TO NX(T): WRITE #1, D(T, N, L)
NEXT N: NEXT L: NEXT T: CLOSE 1: T = TTT: BEEP: IF KA = 2 THEN GOTO TL1
tse:
GOSUB LAYOUT: GOSUB TICKET: SV = 0: GOTO MAIN
TLOAD:
LLL = L: NNN = N: KA = 2
IF TT = 1 THEN GOSUB CHECK: IF CH = 0 THEN GOTO TL1
COLOR 4: CLS : LOCATE 12, 15
PRINT "Shall I save existing data before loading ? (Y/N)"
GOSUB CONFIRM: IF E$ = "Y" THEN GOTO TSAVE
TL1:
SV = 0: FL$ = " Load default data file `LC-DEF.DAT' (Y/N/Esc)"
N$ = "LC-DEF.DAT": GOSUB FNAME
IF N$ = "" THEN
IF V = 76 THEN RETURN
GOSUB LAYOUT: GOSUB TICKET: L = LLL: N = NNN: KA = 0: GOTO MAIN
END IF
TLD:
COLOR 4: CLS : LOCATE 12, 30: PRINT "LOADING DATA FILE"
STLD:
DFC$ = "": OPEN N$ FOR INPUT AS #1: INPUT #1, DFC$
IF DFC$ <> FCH$ AND DFC$ <> FCH2$ THEN
BEEP: N$ = "": IF ST = 1 THEN ST = 2
CLS : COLOR 20: LOCATE 12, 25: PRINT "Not a LOTTO CHECK data file....!!"
GOSUB PAUSE: CLOSE 1: IF ST = 2 OR V = 76 THEN KA = 0: RETURN
GOSUB LAYOUT: GOSUB TICKET: L = LLL: N = NNN: KA = 0: GOTO MAIN
END IF: IF ST = 0 THEN GOSUB TEDIT
IF DFC$ = FCH$ THEN MD$ = "1" ELSE INPUT #1, MD$
GOSUB TLIMITS
INPUT #1, TT: FOR T = 1 TO TT: INPUT #1, X$(T), GT(T), NX(T)
FOR L = 1 TO GT(T): FOR N = 1 TO NX(T): INPUT #1, D(T, N, L): NEXT N: NEXT L
NEXT T: CLOSE 1: BEEP: KA = 0: IF V = 76 OR ST = 1 THEN RETURN
T = 1: GOSUB LAYOUT: GOSUB TICKET: GOTO MAIN
FNAME:
COLOR 7: CLS : PRINT FL$
DO: NM$ = UCASE$(INKEY$): IF NM$ = "Y" THEN RETURN
IF NM$ = CHR$(27) THEN N$ = "": RETURN
IF NM$ = "N" THEN EXIT DO
LOOP: DR$ = "DAT": IF G$ = "S" THEN DR$ = "TXT"
FNM:
PRINT : SHELL "DIR *." + DR$ + " /B"
COLOR 6: PRINT : PRINT " Enter nothing to escape."
COLOR 7: INPUT " Enter file name (No extension)"; NM$
FX = 0: FY = 1: FS = 0: COLOR 4: PRINT : FL = LEN(NM$)
IF MID$(NM$, 2, 1) = ":" THEN FY = 3
FOR ER = 0 TO 14
IF INSTR(FY, NM$, E$(ER)) > 0 OR MID$(NM$, 1, 1) = E$(ER) THEN
BEEP: COLOR 14: PRINT E$(ER); : COLOR 4
PRINT " Invalid character in path or file name.": GOTO FNM
END IF
NEXT ER
DO: IF FX > 0 THEN FY = FX + 1
FX = INSTR(FY, NM$, "\"): FZ = FX - FY: FS = FS + 1
IF FX = 0 THEN
FZ = FL - FY + 1: IF FZ > 8 THEN PRINT "File name "; : EXIT DO
IF FZ = 0 THEN
IF FL > 0 THEN BEEP: PRINT "What.!! Path with no file name..!": GOTO FNM
N$ = "": RETURN
END IF
N$ = NM$ + ".DAT": IF G$ = "S" THEN N$ = NM$ + ".TXT"
RETURN
END IF: IF FZ > 8 THEN PRINT "Directory name"; FS; : EXIT DO
LOOP: PRINT "should be no more than 8 characters long.": BEEP: GOTO FNM
FCHECK:
COLOR 4: OPEN N$ FOR INPUT AS #1: CLOSE 1: PRINT
PRINT " File already exists. Shall I overwrite ? (Y/N)"
GOSUB CONFIRM: RETURN
TGOTO:
GOSUB DCHECK: IF DCH = 1 THEN GOTO MAIN
COLOR 7: CLS : TTT = T
TGOT:
COLOR 7: INPUT " Goto ticket number "; T
IF T < 1 THEN T = TTT
IF T > TT THEN BEEP: COLOR 4: PRINT : PRINT "Ticket does not exist.": PRINT : COLOR 7: GOTO TGOT
IF Z$ = "G" THEN RETURN
GOSUB LAYOUT: GOSUB TICKET: GOTO MAIN
TSORT:
GOSUB DCHECK: IF DCH = 1 THEN GOTO MAIN
TTT = T: T = TT: GOSUB CHECK: TT2 = TT: IF CH = 0 THEN TT2 = TT - 1
COLOR 7: CLS : LOCATE 12, 30: PRINT "Sorting all tickets."
FOR T = 1 TO TT2
FOR L = 1 TO GT(T)
FOR N = 1 TO NX(T): R(N) = D(T, N, L): NEXT N
GOSUB RSORT
NEXT L
NEXT T: T = TTT: BEEP: GOSUB LAYOUT: GOSUB TICKET: GOTO MAIN
RSORT:
NXT = NX(T): IF MD$ = "4" THEN NXT = D(T, 11, L)
IF MD$ = "2" THEN NXT = NX(T) - 1: D(T, NX(T), L) = R(NX(T)): R(NX(T)) = 0
FOR N = 1 TO NXT: NX = NXT - N + 1: D(T, NX, L) = 0: FOR S = 1 TO NXT
IF R(S) > D(T, NX, L) THEN D(T, NX, L) = R(S): CL = S
NEXT S: R(CL) = 0: NEXT N: RETURN
GINSERT:
LLL = L: NNN = N: TA = T: TB = T: TZ = T: NC = NX(T): GT(T) = GT(T) + 1: GL = GT(T) - L - 1
FOR GE = 0 TO GL: LL = GT(T) - GE: LB = LL - 1: GOSUB GCOPY: NEXT GE: LL = LLL
GOSUB GZERO: GOSUB LAYOUT: GOSUB TICKET: L = LLL: N = NNN: GOTO MAIN
TINSERT:
GOSUB DCHECK: GOSUB CHECK: IF CH = 0 OR DCH = 1 THEN GOTO MAIN
TTT = T: T = TT: GOSUB CHECK: T = TTT: IF TT = TMX AND CH > 0 THEN GOTO MAIN
LOCATE 23, 30: COLOR 4: PRINT "Inserting ticket.": IF CH > 0 THEN TT = TT + 1
TL = TT - T - 1: FOR TI = 0 TO TL: TA = TT - TI: TB = TA - 1: GOSUB TCOPY: NEXT TI
TZ = T: GOSUB TZERO: L = 1: N = 1: GOSUB LAYOUT: BEEP: GOTO MAIN
TCOPY:
X$(TA) = X$(TB): GT(TA) = GT(TB): NX(TA) = NX(TB): NC = NX(TA)
FOR LL = 1 TO GT(TA): LB = LL: GOSUB GCOPY: NEXT LL: RETURN
GCOPY:
FOR NN = 1 TO NC: D(TA, NN, LL) = D(TB, NN, LB): NEXT NN: RETURN
TZERO:
X$(TZ) = "": FOR LL = 1 TO GT(TZ): GOSUB GZERO: NEXT LL: RETURN
GZERO:
NZ = NX(TZ): IF TZ = 0 AND LL = 0 THEN NZ = 25
FOR NN = 1 TO NZ: D(TZ, NN, LL) = 0: NEXT NN: RETURN
TERASE:
GOSUB CHECK: IF T = TT AND CH = 0 THEN GOTO MAIN
LOCATE 23, 30: COLOR 4: PRINT "Erasing ticket."
IF T < TT THEN
TL = TT - T - 1: FOR TE = 0 TO TL: TA = T + TE: TB = TA + 1: GOSUB TCOPY: NEXT TE
END IF
TZ = TT: GOSUB TZERO: TT = TT - 1: GOSUB LAYOUT: GOSUB TICKET: BEEP: GOTO MAIN
GERASE:
IF GT(T) < 2 THEN GOTO TERASE
LLL = L: NNN = N: TA = T: TB = T: TZ = T: NC = NX(T)
IF L < GT(T) THEN
GL = GT(T) - L - 1: FOR GE = 0 TO GL: LL = L + GE: LB = LL + 1: GOSUB GCOPY: NEXT GE
END IF
LL = GT(T): GOSUB GZERO: GT(T) = GT(T) - 1: GOSUB LAYOUT: GOSUB TICKET
L = LLL: IF L > GT(T) THEN L = GT(T)
N = NNN: GOTO MAIN
TPRINT:
TTT = T: T = TT: GOSUB CHECK: IF CH = 0 THEN TT = TT - 1
IF TT = 0 THEN GOTO MAIN
TPRT:
NNN = N: LLL = L: OPEN PR$ FOR OUTPUT AS 1
IF A$ = PT$ THEN GOSUB TPR: GOTO PREND
IF GCH = 1 THEN PRINT #1, "": GOSUB GPR: GCH = 0: GOTO PREND
FOR T = 1 TO TT: GOSUB TPR: NEXT T: T = TTT
PREND:
CLOSE #1: L = LLL: N = NNN: BEEP: GOTO MAIN
TPR:
SUSS = NX(T): GOSUB SYSUSS
PRINT #1, X$(T); SYS$; " ticket"; T; LF$; : SP$ = " ": IF NX(T) = 20 THEN SP$ = ""
FOR L = 1 TO GT(T): GOSUB GPR: NEXT L: PRINT #1, LF$; : RETURN
GPR:
PRINT #1, CHR$(64 + L); " ";
FOR N = 1 TO NX(T)
PP$ = STR$(D(T, N, L)): IF D(T, N, L) = 0 THEN PP$ = " "
SS$ = "": IF D(T, N, L) > 0 AND D(T, N, L) < 10 THEN SS$ = " "
PRINT #1, SS$; PP$; SP$;
IF MD$ = "4" AND N = NX(T) - 1 THEN PRINT #1, " Spot";
IF MD$ = "2" AND N = NX(T) - 1 THEN PRINT #1, " PB";
NEXT N: PRINT #1, "": RETURN
CONFIRM:
BEEP: DO: E$ = UCASE$(INKEY$): IF E$ = "Y" OR E$ = "N" THEN RETURN
LOOP
PAUSE:
PP$ = CHR$(13): COLOR 15: LOCATE 23, 27: PRINT "PRESS ENTER TO CONTINUE."
PS1:
DO: IF INKEY$ = PP$ THEN RETURN
LOOP
TERROR:
IF ERR = 53 AND SV = 1 THEN RESUME tsv2
COLOR 4: BEEP: CLS : LOCATE 12, 30
IF ERR = 53 THEN
PRINT "Data file not found.": GOSUB PAUSE
IF ST = 1 THEN P$ = "O": RESUME OPTIONS
RESUME OPT
END IF
IF ERR = 64 OR ERR = 76 THEN
IF ERR = 64 THEN PRINT "Bad file name." ELSE PRINT "Path not found."
GOSUB PAUSE: IF SV = 1 THEN RESUME TSV
RESUME OPT
END IF
IF ERDEV = 10 THEN
CLOSE #1: PRINT "PRINTER NOT ACTIVE !!": GOSUB PAUSE
IF Z$ = "P" THEN RESUME TTSHOW
GOSUB LAYOUT: GOSUB TICKET: L = LLL: N = NNN: RESUME MAIN
END IF
PRINT "ERROR No"; ERR; "NOT DEFINED": END
OPT:
IF V = 76 THEN
GOSUB TL1: IF N$ <> "" THEN GOTO SUSS
GOTO OPTIONS
ELSE
GOTO TL1
END IF
TEND:
WIDTH 80: COLOR 7, 0: POKE 1047, KF: DEF SEG : CLS : END
ABOUT:
WIDTH 80: GOSUB TITLE
PRINT " This version of Lotto Check both for the Amiga and IBM, was written on an"
PRINT " Amiga 1200 equiped with a Blizzard 68060 board. The IBM version was ported"
PRINT " from the Amiga version using `PCx' the best & fastest IBM emulator I have"
PRINT " have ever seen for the Amiga, which was written by Jim Drew & MicroCode"
PRINT " Solutions. Thanks Jim & MicroCode. Looking forward to future versions of"
PRINT " this excellent program. Thanks to"; : COLOR 2: PRINT " Richard Gormley"; : COLOR 7: PRINT " for scrutinizing,"
PRINT " bug testing and program suggestions. Thanks to "; : COLOR 2: PRINT "Warren Rizzi"; : COLOR 7: PRINT " for the icon"
PRINT " on the Amiga version."
PRINT SPACE$(25); : COLOR 20: PRINT "This program is `ShareWare'": COLOR 7
PRINT " If you try this program and wish to continue to use it, you may do so"
PRINT " provided you do following as payment:-": COLOR 15
PRINT " * Send a disk with some PD on it, preferably AMIGA PD but IBM PD will"
PRINT " be accepted."
PRINT " * Let me know whether you are using the AMIGA or IBM version, the version"
PRINT " number, tell what you think of it and if you have found bugs let me"
PRINT " know what they are.": COLOR 7
PRINT " Payment should be sent to:"; : COLOR 6: PRINT " LORRY"
PRINT " 5 Rankin street"
PRINT " Altona, Victoria,"
PRINT " Australia, 3018.": COLOR 15
PRINT SPACE$(27); "Press space to continue": PP$ = " ": GOSUB PS1: GOSUB TITLE
PRINT " I dont think that I am asking for too much. If you dont comply to the"
PRINT " ShareWare requirements then you are a very naughty immoral person and I"
PRINT " hope your hard disk is wiped by a virus or your computer mysteriously"
PRINT " self combusts.": PRINT : PRINT : COLOR 6
PRINT " This program may be freely distributed on PD libraries."
COLOR 4: PRINT : PRINT : PRINT " LEGAL CRAP:": COLOR 7
PRINT " Although I have never known this program to fail I can not take any"
PRINT " responsibility for failure of this program or for human data entry error."
GOSUB PAUSE: GOTO OPTIONS